from machine import Pin,SPI
import time
led = Pin(4, Pin.OPEN_DRAIN)
# construct a SoftSPI bus on the given pins
# polarity is the idle state of SCK
# phase=0 means sample on the first edge of SCK, phase=1 means the second
clk = Pin(15, Pin.OUT)
mosi = Pin(2, Pin.OUT)
miso = Pin(5, Pin.IN)
spi = SPI(-1,baudrate=10000000, polarity = 1, phase = 0, bits = 8, firstbit = SPI.MSB, sck = clk, mosi = mosi, miso = miso)

led.value(1)
led.value(0)
spi.write( b"\xD4")
spi.write( b"\xD4")
spi.write( b"\xD4")
data=spi.read(10)
print(data)
led.value(1)
